<!--
 * @Description: 
 * @Author: rendc
 * @Date: 2024-11-13 19:16:26
 * @LastEditors: rendc
 * @LastEditTime: 2024-11-13 19:16:56
-->
<template>
    <div>
      <h2>登录</h2>
      <input type="text" v-model="username" placeholder="用户名" />
      <input type="password" v-model="password" placeholder="密码" />
      <button @click="login">登录</button>
      <button @click="switchToRegister">注册</button>
    </div>
  </template>
  
  <script>
  export default {
    data() {
      return {
        username: '',
        password: ''
      };
    },
    methods: {
      login() {
        if (this.username === 'admin' && this.password === '123') {
          alert('登录成功');
        } else {
          alert('登录失败');
        }
      },
      switchToRegister() {
        // 切换到注册页面的逻辑，可以通过改变一个标志位或者使用路由来实现
      }
    }
  };
  </script>